using System;
using System.Web.Mvc;
using Uber.Core.Model;
using Uber.Core.Repository;
using Uber.Core.Security;
using Uber.Infra;

namespace Uber.WebUI.Controllers
{
    public class UberController : Controller
    {
        public ActionResult DisplayName()
        {
            if (Request.IsAuthenticated )
            {
                try
                {
                    var a = IoC.Resolve<IRepo<Account>>().Get(Gl.UserId());
                    if (a == null) IoC.Resolve<IFormsAuthentication>().SignOut();
                    else
                        return
                            Content(string.Format("<a href='{0}'>{1}</a>", Url.Action("index", "profile"), a.DisplayName));
                }
                catch(Exception ex)
                {
                    ex.Raize();
                }
            }
            return Content(" ");
        } 
    }
}